import 'babel-polyfill'
import Vue from 'vue'
import App from './App'
import router from './router'
import iView from 'iview'
import store from '@/store/index'
import fundebug from 'fundebug-javascript'
// require('./src/common/js/draggable.js')
// import './src/common/js/draggable.js'
// import '@/common/js/draggable.js'

// 引入iview的样式
//import 'iview/dist/styles/iview.css';
import './my-theme/index.less';
import './common/common.less';

Vue.prototype.$Loading = iView.LoadingBar

Vue.use(iView, {
  transfer: true,
  size: 'default'
});


router.beforeEach((to, from, next) => {
  /* 路由发生变化修改页面title */
  // if (to.meta.title) {
  // 	document.title = to.meta.title
  // }
  next()
})
/*
if (process.env.NODE_ENV === 'production') {
  fundebug.apikey = '1b09652a4e708c926627bd979327d0408d712fdd3e24665877e310c2a214781a';
  function formatComponentName(vm) {
    if (vm.$root === vm) return 'root';

    var name = vm._isVue ? (vm.$options && vm.$options.name) || (vm.$options && vm.$options._componentTag) : vm.name;
    return (name ? 'component <' + name + '>' : 'anonymous component') + (vm._isVue && vm.$options && vm.$options.__file ? ' at ' + (vm.$options && vm.$options.__file) : '');

  }

  Vue.config.errorHandler = function (err, vm, info) {
    var componentName = formatComponentName(vm);
    var propsData = vm.$options && vm.$options.propsData;

    fundebug.notifyError(err,
      {
        metaData:
        {
          componentName: componentName,
          propsData: propsData,
          info: info
        }
      });
  };
}
if(process.env.NODE_ENV == 'development') {
    // 生产环境下，开启vue的调试模式
    Vue.config.devtools = true;
}
*/
Vue.config.productionTip = false;

window.eventBus = new Vue();

/* eslint-disable no-new */
window.vm = new Vue({
  el: '#app',
  router,
  store,
  render: h => h(App)
})

